#include "readline.h"

inline int
readline (char *message, int *mymessage, int count, char *bufptr, size_t len)
{
  int mylen;
  int i = (*mymessage);
  while (i < count && message[i] != '\n')
    i++;
  mylen = i - (*mymessage);
  if (mylen > len)
    return -1;
  if (mylen)
    memcpy (bufptr, &message[(*mymessage)], mylen);
  (*mymessage) = i + 1;
  return mylen;
};

